package user;

import book.BookList;
import ioperations.*;

public class AdminUser extends User{
    public IOperation[] operations;
    @Override
    public void menu() {
        System.out.println("************选择操作************");
        System.out.println("1.查阅书籍");
        System.out.println("2.借阅书籍");
        System.out.println("3.归还书籍");
        System.out.println("4.查找书籍");
        System.out.println("5.增加书籍");
        System.out.println("6.删除书籍");
        System.out.println("7.退出");
    }

    public AdminUser(String name) {
        super(name);
        operations = new IOperation[]{new ListOp(), new BorrowOp(),
                    new ReturnOp(), new FindOp(), new AddOp(),
                    new DeleteOp(), new ExitOp()};
    }

    @Override
    public void doOp(int choice, BookList books) {
        if(choice > 7 || choice < 1)
            System.out.println("非法输入");
        else operations[choice - 1].work(books);
    }

}
